/**
 *
 * @authors Your Name (you@example.org)
 * @date    2018-04-18 09:36:42
 * @version $Id$
 */

function setCookie(name, value, exdays) {
  var d = new Date();
  d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
  var expires = "expires=" + d.toGMTString();
  document.cookie = name + "=" + value + "; " + expires;
}

function getCookie(cname) {
  var name = cname + "=";
  var ca = document.cookie.split(';');
  for (var i = 0; i < ca.length; i++) {
    var c = ca[i].trim();
    if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); }
  }
  return "";
}

function checkCookie() {
  var user = getCookie("accounts");
  if (user != "") {
    $('.topbar_login').html('<a href="#">' + user + '</a>' + '|<a href="javascript:logonout()">登出</a>')
  } else {}
}

function delCookie(name,value){
  var expires = "expires=Thu, 01 Jan 1970 00:00:00 GMT";
  document.cookie = name + "=" + value + "; " + expires;

}


